<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>添加作息时间</title>
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<link href="css/table.css" rel="stylesheet" type="text/css" />
		<style type="text/css">
			body{FONT-FAMILY: 宋体;FONT-SIZE: 12px;}
		</style>
		<script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"
			language="javascript"></script>
		<script type="text/javascript">
			function addAttendTime(){
				var startTime =$("#startTime1").val();
				var endTime =$("#startTime2").val();
				var amTime1 =$("#amTime1").val();
				var amTime2 =$("#amTime2").val();
				var amRest1 =$("#amRest1").val();
				var amRest2 =$("#amRest2").val();
				var pmTime1 =$("#pmTime1").val();
				var pmTime2 =$("#pmTime2").val();
				var pmRest1 =$("#pmRest1").val();
				var pmRest2 =$("#pmRest2").val();
				var nightTime1 =$("#nightTime1").val();
				var nightTime2 =$("#nightTime2").val();
				var nightRest1 =$("#nightRest1").val();
				var nightRest2 =$("#nightRest2").val();
				var note =$("#note").val();
				
				var reg=/^(\d{2}):(\d{2})$/;
				if($.trim(startTime)=='')
				{
					alert("请选择开始时间！");
					return;
				}
				if($.trim(endTime)=='')
				{
					alert("请选择结束时间！");
					return;
				}
				if($.trim(amTime1)==''||$.trim(amTime2)=='')
				{
					alert("请设置上午上班时间！");
					return;
				}
				if($.trim(amRest1)==''||$.trim(amRest2)=='')
				{
					alert("请设置上午下班时间！");
					return;
				}
				if($.trim(pmTime1)==''||$.trim(pmTime2)=='')
				{
					alert("请设置下午上班时间！");
					return;
				}
				if($.trim(pmRest1)==''||$.trim(pmRest2)=='')
				{
					alert("请设置下午下班时间！");
					return;
				}
				if($.trim(nightRest1)==''||$.trim(nightRest2)=='')
				{
					alert("请设置晚班下班时间！");
					return;
				}
				if($.trim(nightTime1)==''||$.trim(nightTime2)=='')
				{
					alert("请设置晚班上班时间！");
					return;
				}
				var amTime=amTime1+":"+amTime2;
				var amRest=amRest1+":"+amRest2;
				var pmTime=pmTime1+":"+pmTime2;
				var pmRest=pmRest1+":"+pmRest2;
				var nightTime=nightTime1+":"+nightTime2;
				var nightRest=nightRest1+":"+nightRest2;
				
				var add ={"oas.startTime":startTime,"oas.amTime":amTime,"oas.amRest":amRest,"oas.pmTime":pmTime,"oas.pmRest":pmRest,"oas.nightTime":nightTime,"oas.nightRest":nightRest,"oas.note":note,"oas.status":0,"oas.endTime":endTime};
				
				$.post("addAttendanceTime.action",add,function(data){
					if(data=='success'){
						window.opener.location.reload();
						window.close();
					}else{
						alert("添加失败！");
					}
				});
			}
			
		</script>
	</head>
	<body>
		<table align="center" style="width:450px" class="righ_list" frame="box" cellspacing="1" cellpadding="0"   border="0">
			<tr ><td class="reigh_list2" align="center">作息时间</td></tr>
			<tr style="background: #ffffff">
				<td align="left">
					执 行 时 间  ：<input style="margin: 10px 0 0 0" name="startDate"
						value="${startDate }" class="Wdate" id="startTime1" type="text"
						readonly="readonly"
						onclick="WdatePicker({maxDate:'#F{$dp.$D(\'startTime1\',{d:-0});}'})"
						id="startTime1" /> 到  <input style="margin: 10px 0 0 0" name="startDate"
						value="${startDate }" class="Wdate" id="startTime2" type="text"
						readonly="readonly"
						onclick="WdatePicker({maxDate:'#F{$dp.$D(\'startTime2\',{d:-0});}'})"
						id="startTime2" />
				</td>
			</tr >
			<tr style="background: #ffffff">
				<td align="left">
					上午上班时间：<input id="amTime1" type="text" width="100px" height="30px" size="2" maxlength="2" onKeyUp="if(this.value.length==2) document.getElementById('amTime2').select();"/>:<input id="amTime2" type="text" width="100px" height="30px" size="2" maxlength="2" onKeyUp="if(this.value.length==2) document.getElementById('amRest1').select();"/> &nbsp;&nbsp;<span style="color: #ff6622">*时间格式为24小时制 例：08:00</span>
				</td>
			</tr >
			<tr style="background: #ffffff">
				<td align="left">
					上午下班时间：<input id="amRest1" type="text" width="100px" height="30px" size="2" maxlength="2" onKeyUp="if(this.value.length==2) document.getElementById('amRest2').select();"/>:<input id="amRest2" type="text" width="100px" height="30px" size="2" maxlength="2" onKeyUp="if(this.value.length==2) document.getElementById('pmTime1').select();"/>
				</td>
			</tr >
			<tr style="background: #ffffff">
				<td align="left">
					下午上班时间：<input id="pmTime1" type="text" width="100px" height="30px" size="2" maxlength="2" onKeyUp="if(this.value.length==2) document.getElementById('pmTime2').select();"/>:<input id="pmTime2" type="text" width="100px" height="30px" size="2" maxlength="2" onKeyUp="if(this.value.length==2) document.getElementById('pmRest1').select();"/> &nbsp;&nbsp;<span style="color: #ff6622">*时间格式为24小时制 例：13:00</span>
				</td>
			</tr >
			<tr style="background: #ffffff">
				<td align="left">
					下午下班时间：<input id="pmRest1" type="text" width="100px" height="30px" size="2" maxlength="2" onKeyUp="if(this.value.length==2) document.getElementById('pmRest2').select();"/>:<input id="pmRest2" type="text" width="100px" height="30px" size="2" maxlength="2" onKeyUp="if(this.value.length==2) document.getElementById('nightTime1').select();"/>
				</td>
			</tr >
			<tr style="background: #ffffff">
				<td align="left">
					晚班上班时间：<input id="nightTime1" type="text" width="100px" height="30px" size="2" maxlength="2" onKeyUp="if(this.value.length==2) document.getElementById('nightTime2').select();"/>:<input id="nightTime2" type="text" width="100px" height="30px" size="2" maxlength="2" onKeyUp="if(this.value.length==2) document.getElementById('nightRest1').select();"/>
				</td>
			</tr >
			<tr style="background: #ffffff">
				<td align="left">
					晚班下班时间：<input id="nightRest1" type="text" width="100px" height="30px" size="2" maxlength="2" onKeyUp="if(this.value.length==2) document.getElementById('nightRest2').select();"/>:<input id="nightRest2" type="text" width="100px" height="30px" size="2" maxlength="2"/>
				</td>
			</tr>
			<tr style="background: #ffffff">
				<td align="left">
					&nbsp; 备 &nbsp;&nbsp;&nbsp; 注 ：<input id="note" type="text" width="100px" height="30px" />
				</td>
			</tr >
			<tr style="background: #ffffff">
				<td  align="center">
					<input class="button_02" onclick="addAttendTime()" type="button" value="确定" />
				</td>
			</tr>
		</table>
	</body>
</html>